package com.ximcontroller.views;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;

import processing.core.PApplet;
import processing.core.PFont;

class XIMSingleScreen {

	PApplet p;
	int width, height;
	int x, y;
	int mainColor; 
	
	static int screenNumTotal = 0; 
	int screenNum; 

	String message;
	PFont infoFont;

	public XIMSingleScreen(PApplet p, int x, int y, int width, int height) {

		this.p = p;
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;

		this.infoFont = p.loadFont("ArialMT-48.vlw");

		screenNum = screenNumTotal;
		screenNumTotal = screenNumTotal + 1; 
		
		initialize(); 

	}

	public void initialize() {
		screenBg();
		message = "monitor";

	}

	private void screenBg() {
		p.fill(255);
		p.noStroke();
		p.rect(0, 0, width, height);

	}

	public void calculate() {

	}

	public void render() {
		p.pushMatrix();
		p.translate(this.x, this.y);

		this.screenBg();

		// fill(100);
		// ellipse(10, 10, 10, 10);

		this.info();
		p.popMatrix();

	}

	private void info() {
		p.fill(0, 100);
		p.rect(0, 0, this.width / 3, 15);

		p.textFont(infoFont, 10);

		p.fill(0);
		p.text(message + " " + screenNum, 5, 10);

	}


	/**
	 * @return the mainColor
	 */
	public int getMainColor() {
		return mainColor;
	}

	/**
	 * @param mainColor
	 *            the mainColor to set
	 */
	public void setMainColor(int mainColor) { 
		
		this.mainColor = mainColor;
	}

}
